<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>宠物狗养成模拟游戏</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f8ff;
            margin: 0;
            padding: 0;
            text-align: center;
        }
        .container {
            width: 50%;
            margin: 50px auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 10px;
            background-color: #ffffff;
        }
        h1 {
            color: #333;
        }
        #score-board {
            margin-bottom: 20px;
        }
        #score-board div {
            font-size: 16px;
            color: #555;
        }
        .question {
            margin-bottom: 20px;
            font-size: 18px;
        }
        .option {
            background-color: #4CAF50;
            color: white;
            padding: 10px;
            margin: 5px;
            border: none;
            cursor: pointer;
            border-radius: 5px;
        }
        .option:hover {
            background-color: #45a049;
        }
        /* .end-reslut {
            font-size: 20px;
            margin-top: 20px;
            color: #ff6347;
        } */
        .option-description {
            font-size: 16px;
            color: #333;
            margin-top: 20px;
            font-weight: bold;
        }
        .restart-button {
            display: none;
            background-color: #008CBA;
            color: white;
            padding: 10px 20px;
            margin-top: 20px;
            border: none;
            cursor: pointer;
            border-radius: 5px;
        }
        .restart-button:hover {
            background-color: #007bb5;
        }
        #end-screen {
            display: none;
            padding: 20px;
            background-color: #ffffff;
            border: 1px solid #ccc;
            border-radius: 10px;
        }
        #end-screen h2 {
            font-size: 24px;
            color: #ff6347;
        }
        #end-screen .end-description {
            font-size: 18px;
            color: #555;
        }
        #end-screen .end-note {
            font-size: 26px;
            margin-top: 20px;
            font-style: italic;
        }
    </style>
</head>
<body>

<div class="container" id="game-start">
    <h1>宠物狗养成模拟游戏</h1>
    <button class="option" onclick="startGame()">开始游戏</button>
</div>

<div class="container" id="game-play" style="display: none;">
    <h1>宠物狗养成模拟游戏</h1>
    <div id="score-board">
        <div id="money">金钱: 500</div>
        <div id="health">生命值: 10</div>
        <div id="mood">心情: 10</div>
    </div>
    <div id="question" class="question"></div>
    <div id="options"></div>
    <div id="option-description" class="option-description"></div>
</div>

<div class="container" id="end-screen">
    <h1>宠物狗养成模拟游戏</h1>
    <h2>游戏结束</h2>
    <div id="end-result"></div>
    <div id="end-description" class="end-description"></div>
    <div id="end-note" class="end-note">
        养狗真不是一件容易的事，需要你有时间，有精力，最好还要有充足的预算💰，<br>
        最重要的是，你还要学习很多关于狗狗的知识，这样才能当好一个称职的主人！<br>
        游戏中的题目只是养狗过程中的冰山一角，狗狗也是一条小生命，养狗须谨慎～
    </div>
</div>

<script>
    let money = 500;
    let health = 10;
    let mood = 10;
    let gameEnded = false;
    let currentQuestionIndex = 0;

    const questions = [
        {
            question: "1.你刚买回来一只2个月大的小狗，还没有打疫苗，但是现在它看起来有点脏，你会？",
            options: [
                { text: "给它洗澡", health: 0, money: 0, mood: 0, end: "生病死亡_洗澡", description: "小狗体抗力太弱，洗完澡后重病，没有救回来" },
                { text: "拿湿巾擦擦", health: 0, money: 0, mood: 0, end: "", description: "狗狗变干净了一些！" },
                { text: "不管", health: 0, money: 0, mood: 0, end: "", description: "虽然有点脏，但是也没多大影响" }
            ]
        },
        {
            question: "2.狗狗到家后，一直在叫，吵得你不得安生，这时你打算？",
            options: [
                { text: "可能是不舒服，带它去医院", health: 0, money: -100, mood: 0, end: "", description: "金钱-100。花了钱，医生说只是不适应新环境罢了" },
                { text: "多和它玩，安抚它", health: -1, money: 0, mood: 0, end: "", description: "健康-1。狗狗刚到新环境不应，过多的互动会让狗狗更害怕" },
                { text: "准备好安全的环境，让它自己待着", health: 0, money: 0, mood: 0, end: "", description: "狗狗慢慢适应了新环境，逐渐变得安静了" },
                { text: "喂食", health: 0, money: -50, mood: 0, end: "", description: "金钱-50。怯生生的跑来，光顾着吃饭没空叫了" }
            ]
        },
        {
            question: "3.为了狗狗的健康，我们应该带它去打疫苗，什么时候去比较合适？",
            options: [
                { text: "越快越好", health: -5, money: 0, mood: 0, end: "", description: "健康-5。狗狗原本就不适应新家，又打了疫苗也会有一些不适的症状，雪上加霜，对狗狗健康不利" },
                { text: "等狗狗适应新家后", health: 0, money: 0, mood: 0, end: "", description: "没错，这就是打疫苗的最好时机！" },
                { text: "不打也没事，都是商家骗钱", health: 0, money: 0, mood: 0, end: "生病死亡_疫苗", description: "狗狗之后不幸得了犬瘟热" }
            ]
        },
        {
            question: "4.你经常给狗狗洗澡，狗狗也很干净，还要给狗狗做驱虫吗？",
            options: [
                { text: "不用", health: 0, money: 0, mood: 0, end: "含泪送走", description: "之后狗狗被跳蚤寄生，等发现的时候家里也有了，把你也咬的一身是包，家里很生气，要求你不许再养狗" },
                { text: "每2～3个月做驱虫", health: 0, money: -100, mood: 0, end: "", description: "金钱-100。太棒了！狗狗因为定期驱虫一直保持健康" },
                { text: "半年做1次", health: -2, money: -50, mood: 0, end: "", description: "健康-2，金钱-50。偶尔会感染寄生虫" }
            ]
        },
        {
            question: "5.狗狗一岁了，你正在家里吃完饭，你的狗狗看起来也非常好奇，也想吃你的食物，这时候你会分享给狗狗哪种食物？",
            options: [
                { text: "三文鱼", health: 0, money: 0, mood: 0, end: "", description: "三文鱼富含Omega-3脂肪酸、蛋白质和多种维生素，对狗的健康有益，如改善皮肤状况、保护心脏健康等。但是注意，最好煮熟以确保鱼肉中不会有活体寄生虫，同时喂食注意适量，不要过多，且最好不要喂6个月以下的小狗吃三文鱼。" },
                { text: "巧克力", health: 0, money: 0, mood: 0, end: "中毒死亡", description: "巧克力中的可可碱对狗狗剧毒" },
                { text: "洋葱", health: -2, money: -300, mood: 0, end: "", description: "健康-2，金钱-300。洋葱中含有一种名为正丙基二硫化物的成分，这种物质会导致溶血性贫血，还好吃的不多去医院治疗" },
                { text: "牛奶", health: -1, money: 0, mood: 0, end: "", description: "健康-1。狗狗乳糖不耐，喝了牛奶后放臭屁、腹泻，不过还好没有更严重了" }
            ]
        },
        {
            question: "6.出门遛狗前，你想给狗狗戴上牵引绳，虽然牵引绳尺寸大小是合适的，但是狗狗不配合不想戴，这时你会？",
            options: [
                { text: "那就不戴牵引绳出门吧", health: 0, money: 0, mood: 0, end: "狗狗走失", description: "路上狗狗被其他大狗的吠叫吓坏了，拔腿就跑，尽管你一路猛追还是没追上" },
                { text: "尽量安抚狗狗让它戴上", health: 0, money: 0, mood: 0, end: "", description: "高高兴兴出门啦！" },
                { text: "今天就不去遛狗了", health: -1, money: 0, mood: 0, end: "", description: "健康-1。狗狗今天没出门有点不开心" }
            ]
        },
        {
            question: "7.回家后，家里一片狼藉，原来是狗狗在拆家，你会？",
            options: [
                { text: "教训一顿，不打不长记性", health: 0, money: 0, mood: 0, end: "狗狗咬人，被送走", description: "你揍狗的时候，它突然冲上来咬了你一口，你受伤流血了" },
                { text: "给狗狗买狗玩具", health: 0, money: -100, mood: 0, end: "", description: "金钱-100。拆家的情况明显少了" },
                { text: "增加遛狗的时长", health: 0, money: 0, mood: 0, end: "", description: "拆家的情况明显少了" }
            ]
        },
        {
            question: "8.狗狗非常喜欢吃零食，常常为了零食摇尾乞怜，你决定？",
            options: [
                { text: "只要狗狗需要就尽量满足，不差钱", health: 0, money: -50, mood: 0, end: "三高肥狗", description: "结果狗狗越来越挑食，并且越来越胖了" },
                { text: "扣扣搜搜，少量供给", health: 0, money: 0, mood: 0, end: "", description: "你会在狗狗做对指令时奖励它，它会的指令越来越多了" }
            ]
        },
        {
            question: "9.带狗狗去朋友家，他对新环境里的东西很好奇，它玩哪一个【不会】太过危险？",
            options: [
                { text: "花叶万年青", health: 0, money: -300, mood: 0, end: "", description: "金钱-500。对狗来说有剧毒，它啃了一口还好被你及时阻止，索性吃的不多，去医院进行治疗后好了" },
                { text: "水仙花", health: 0, money: -300, mood: 0, end: "", description: "金钱-500。对狗来说有剧毒，它啃了一口还好被你及时阻止，索性吃的不多，去医院进行治疗后好。" },
                { text: "塑料瓶", health: 0, money: 0, mood: 0, end: "", description: "化身足球小将，玩的不亦乐乎" },
                { text: "橡皮", health: -2, money: 0, mood: 0, end: "", description: "健康-2。小狗容易误食橡皮" }
            ]
        },
        {
            question: "10.你有事出门3天，家里没有其他人，这时你选择？",
            options: [
                { text: "把狗狗寄养在正规的宠物医院", health: 0, money: -300, mood: 0, end: "", description: "金钱-300。狗狗很想你，但是好在得到了合理的照料" },
                { text: "在家里准备好充足的食物和水，让狗狗自己在家", health: -2, money: 0, mood: 0, end: "", description: "健康-2。狗狗很孤独又缺乏运动，心情不好，食欲不振" },
                { text: "请信任的人，每天遛狗铲屎", health: 0, money: -150, mood: 0, end: "", description: "金钱-150。狗狗很想你，但是好在每天能出去玩，心情不错" }
            ]
        }
    ];

    function startGame() {
        document.getElementById('game-start').style.display = 'none';
        document.getElementById('game-play').style.display = 'block';
        gameEnded = false;
        currentQuestionIndex = 0;
        money = 500;
        health = 10;
        mood = 10;
        updateScoreBoard();
        nextQuestion(currentQuestionIndex);
    }

    function updateScoreBoard() {
        document.getElementById("money").innerText = "金钱: " + money;
        document.getElementById("health").innerText = "生命值: " + health;
        document.getElementById("mood").innerText = "心情: " + mood;
    }

    function nextQuestion(questionIndex) {
        if (gameEnded) return;

        const questionData = questions[questionIndex];
        document.getElementById("question").innerText = questionData.question;

        let optionsHtml = "";
        questionData.options.forEach((option, index) => {
            optionsHtml += `<button class="option" onclick="makeChoice(${questionIndex}, ${index}, this)">${option.text}</button>`;
        });
        document.getElementById("options").innerHTML = optionsHtml;
    }

    function makeChoice(questionIndex, optionIndex, button) {
        if (gameEnded) return;

        // 禁用所有按钮，防止多次点击
        disableOptions();

        const selectedOption = questions[questionIndex].options[optionIndex];
        money += selectedOption.money;
        health += selectedOption.health;
        mood += selectedOption.mood;

        document.getElementById("option-description").innerText = selectedOption.description;

        if (selectedOption.end) {
            gameEnded = true;
            endGame(selectedOption.end);
            return;
        }

        if (money <= 0 || health <= 0) {
            gameEnded = true;
            if (money <= 0){
              showEndMessage("游戏结束，您破产了！");
            }
            if (health <= 0){
              showEndMessage("游戏结束，小狗生命值太低病死了");
            }
            return;
        }

        updateScoreBoard();

        setTimeout(() => {
            if (currentQuestionIndex < questions.length - 1) {
                currentQuestionIndex++;
                nextQuestion(currentQuestionIndex);
            } else {
                gameEnded = true;
                endGame("恭喜通关，你获得了养狗达人称号！");
            }
        }, 1500);
    }

    function endGame(result) {
        document.getElementById('game-play').style.display = 'none';
        document.getElementById('end-screen').style.display = 'block';
        
        let endMessage = "";
        let additionalMessage = "";

        switch(result) {
            case "生病死亡_洗澡":
                endMessage = "结局：生病死亡。你的狗狗因生病去世了。";
                additionalMessage = "刚出生的小狗免疫力非常低，主要依靠母犬的照顾和母乳中的抗体来维持健康。洗澡可能会使它们受寒、生病，甚至危及生命。一般来说，出生后2个月以内的小狗不建议洗澡。‌";
                break;
            case "生病死亡_疫苗":
                endMessage = "结局：生病死亡。你的狗狗因生病去世了。";
                additionalMessage = "狗打疫苗的主要原因是为了预防传染病、增强免疫力、保障公共卫生、符合法规要求以及减少治疗成本。疫苗能够帮助狗预防多种严重的传染病，如犬瘟热、细小病毒病和狂犬病等，这些疾病对狗的健康危害极大。通过接种疫苗，狗的免疫系统会被刺激，从而更好地抵御病原体的入侵，降低患病的风险。";
                break;
            case "含泪送走":
                endMessage = "结局：含泪送走。您的狗狗被家里人送走了。";
                additionalMessage = "";
                break;
            case "中毒死亡":
                endMessage = "结局：中毒死亡。您的狗狗因为中毒去世了。";
                additionalMessage = "";
                break;
            case "狗狗走失":
                endMessage = "结局：狗狗丢失。您的狗狗受惊吓跑丢了。";
                additionalMessage = "遛狗请务必牵绳！即使狗狗平时很乖很听话，在遭受一些刺激时，仍有可能因为惊吓走失，或者冲上马路造成交通事故，对狗狗造成极大伤害甚至死亡。此外，不牵绳还可能会吓到怕狗的路人，甚至造成伤人事件，给主人带来巨大的财产损失。";
                break;
            case "狗狗咬人，被送走":
                endMessage = "结局：狗狗咬人，被送走。您的狗狗因为咬人被家里人送走了";
                additionalMessage = "";
                break;
            case "三高肥狗":
                endMessage = "结局：三高肥狗。您的狗狗患上了三高，健康状况堪忧。";
                additionalMessage = "狗狗也会得高血糖/高血压/高血脂哦，放任狗狗多吃零食会让狗狗变得挑食，每日摄入热量过高而肥胖，如果不加以干预就会有“三高”，这些疾病也会导致其他危险的并发症，例如糖尿病、失明、心脑血管疾病、肾病等。";
                break;
            case "游戏结束，您破产了！":
                endMessage = "结局：破产。您因资金不足而失败。";
                additionalMessage = "财务管理失败，无法继续抚养狗狗。";
                break;
            case "游戏结束，小狗生命值太低病死了！":
                endMessage = "结局：狗狗病死。您因小狗病死而失败。";
                additionalMessage = "";
                break;
            default:
                endMessage = "结局：恭喜通关，你获得了养狗达人称号！";
                additionalMessage = "通过这场游戏，您学到了如何正确照顾狗狗。";
                break;
        }

        document.getElementById("end-result").innerText = endMessage;
        document.getElementById("end-description").innerText = additionalMessage;
    }

    function disableOptions() {
        const options = document.querySelectorAll(".option");
        options.forEach(option => {
            option.disabled = true;
        });
    }

</script>
</body>
</html>
